<?php

class Pessoa extends Record
{
	var $default = array(
		'nome' => "Rui Costa",
		'id' => null
	);
	
	public function __construct($default = null)
	{
		if(is_null($default))
		{
			$this->data = $this->default;
		}
		else
		{
			$this->data = $default;
		}
	}
	
	public function save()
	{
		$dbh = DB::getInstance();
		$id = $this['id'];
		if($id)
		{
			#update
		}
		else
		{
			#insert
		}
	}
	
	public function delete()
	{
		$dbh = DB::getInstance();
		$id = $this->data['id'];
		
		$sql = "DELETE FROM pessoas where id = $id;";
		$sth = $dbh->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
		$sth->execute();
	}
}


?>